#include <algorithm>
#include <ctype.h>
#include<iostream>
#include<regex>
using namespace std;
class Solution {
    vector<string>country={"","+*-","+**-","+***-"};
public:
    string maskPII(string s) {
        string res;
       auto at= s.find("@");
       if(at != string::npos)
       {
        transform(s.begin(),s.end(),s.begin(),::tolower);
        return s.substr(0,1)+"*****"+s.substr(at-1);
       }

            s=regex_replace(s,regex("[^0-9]"),"");
            return country[s.size()-10]+"***-***-"+s.substr(s.size()-4);

    }
};